package cn.foolishbird.crow.springmvc.response;

import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;

/**
 * 分页返回
 *
 * @author foolish bird
 * @email luohongtu@foolishbird.cn
 */
public class PageResponse<T> implements Serializable {

    private static final long serialVersionUID = -3030608059426135687L;

    /**
     * 当前页
     */
    @ApiModelProperty("当前页")
    private long pageNumber;

    /**
     * 一页总数量
     */
    @ApiModelProperty("一页总数量")
    private long pageSize;

    /**
     * 总数量
     */
    @ApiModelProperty("总数量")
    private long totalElements;

    /**
     * 内容
     */
    @ApiModelProperty("内容")
    private List<T> content;

    public PageResponse(long pageNumber, long pageSize) {
        this.pageNumber = pageNumber;
        this.pageSize = pageSize;
    }

    public PageResponse(long totalElements, List<T> content) {
        this.totalElements = totalElements;
        this.content = content;
    }


    public long getPageNumber() {
        return pageNumber;
    }

    public void setPageNumber(long pageNumber) {
        this.pageNumber = pageNumber;
    }

    public long getPageSize() {
        return pageSize;
    }

    public void setPageSize(long pageSize) {
        this.pageSize = pageSize;
    }

    public long getTotalElements() {
        return totalElements;
    }

    public void setTotalElements(long totalElements) {
        this.totalElements = totalElements;
    }

    public List<T> getContent() {
        return content;
    }

    public void setContent(List<T> content) {
        this.content = content;
    }
}
